/**  
 * All rights Reserved, Designed By daiw
 * @Title:  MqMessageListener.java   
 * @Package org.component.integration.samples.mq   
 * @Description:    TODO (用一句话描述该文件做什么)   
 * @author: daiw     
 * @date:   2019年10月15日 下午4:53:16   
 * @Copyright: 2019 daiw Inc. All rights reserved. 
 */
package org.component.integration.samples.mq;

import javax.jms.JMSException;
import javax.jms.Message;

import org.springframework.jms.annotation.JmsListener;
import org.springframework.jms.listener.adapter.MessageListenerAdapter;
import org.springframework.jms.support.converter.MessageConversionException;
import org.springframework.stereotype.Component;

/**
 * @ClassName: MqMessageListener
 * @Description: TODO (这里用一句话描述这个类的作用)
 * @author: daiw
 * @date: 2019年10月15日 下午4:53:16
 */
@Component("mqMessageListener")
public class MqMessageListener extends MessageListenerAdapter {

	@JmsListener(destination = "${org_easy_mq_send}", concurrency = "5-10")
	public void onMessage(Message message) {
		try {
			Object bean = getMessageConverter().fromMessage(message);
			System.out.println("接收到消息内容：" + bean.toString());
		} catch (MessageConversionException e) {
			e.printStackTrace();
		} catch (JMSException e) {
			e.printStackTrace();
		}

	}
}
